package com.g4.shoppingsingle.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.g4.shoppingsingle.mapper.DdKindTypeMapper;
import com.g4.shoppingsingle.pojo.DdKindType;
import com.g4.shoppingsingle.service.IDdKindTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 型号列表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2021-10-27
 */
@Service
@Slf4j
public class DdKindTypeServiceImpl extends ServiceImpl<DdKindTypeMapper, DdKindType> implements IDdKindTypeService {


    @Autowired(required = false)
    private DdKindTypeMapper ddKindTypeMapper;

    /**
     * 根据商品id获取
     * @return
     */
    @Override
    public List<DdKindType> getKindType(Integer pdId) {
        //通过商品id来进行查询
        QueryWrapper<DdKindType> wrapper = new QueryWrapper<>();
        wrapper.eq("pd_id",pdId);  //where pd_id = 3
        //查询数据库
        List<DdKindType> list = ddKindTypeMapper.selectList(wrapper);
        //返回
        return list;
    }
}